#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <iconv.h>
#include <glib.h>

#include "util.h"

static int iconv_list(unsigned int count, const char * const *names, void *data) {
	for (unsigned int i = 0; i < count; i++) {
		data = g_list_append(data, (gpointer) names[i]);
	}
	return 0;
}

/*
 *
 GList *list = encodinglist();
 for (GList *names = g_list_first(list); names; names = g_list_next(names)) {
 if (names->data) {
 printf("[%s]\n", (char *) names->data);
 }
 }
 g_list_free(list);
 *
 * */
GList *encodinglist() {
	GList *list = g_list_alloc();
	libiconvlist(iconv_list, (void *) list);
	return list;
}
